package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author yp
 * @since 2024-07-23
 */
@RestController
@RequestMapping("/replies")
@Slf4j
@Api(tags = "回答相关接口")
@RequiredArgsConstructor
public class InteractionReplyController {
    private final IInteractionReplyService replyService;

    /**
     * 新增回复
     *
     * @param replyDTO
     */
    @PostMapping
    @ApiOperation("新增回复接口")
    public void addReply(@RequestBody ReplyDTO replyDTO) {
        replyService.addReply(replyDTO);
    }

    @GetMapping("/page")
    @ApiOperation("分页查询回答")
    public PageDTO<ReplyVO> queryReply(@Validated ReplyPageQuery PageQuery) {
        return replyService.queryRepky(PageQuery);
    }
}
